🌐
Videos Blog About Series πŸ—ΊοΈ
❓
πŸ”‘
/users/Thomas A. Baugh:

Thomas A. Baugh πŸ”— 1607537893  



NGINX Unit: new kid on the PSGI block πŸ”— 1697150850  

🏷️ blog

For those of you not aware, there has been a new entry in the PSGI server software field, this time by NGINX. Let's dig in.

Performance Comparisons

Low Spec
# It may shock you to find I have worked with shared hosts.
Env: 4GB ram, 2cpu.

# This is basically saturating this host.
# we can do more, but we start falling down in ways ab stops working.
ab -n10000 -k -c1000 $APP_URI

Starman:
Requests per second:    198.94 [#/sec] (mean)
Time per request:       5026.727 [ms] (mean)
Time per request:       5.027 [ms] (mean, across all concurrent requests)
Transfer rate:          3835.30 [Kbytes/sec] received

uWSGI (I could only get to ~5k reqs w/ 800 requestors before it fell over):
Requests per second:    74.44 [#/sec] (mean)
Time per request:       10746.244 [ms] (mean)
Time per request:       13.433 [ms] (mean, across all concurrent requests)
Transfer rate:          1481.30 [Kbytes/sec] received

nginx-unit:
Requests per second:    275.60 [#/sec] (mean)
Time per request:       3628.429 [ms] (mean)
Time per request:       3.628 [ms] (mean, across all concurrent requests)
Transfer rate:          5333.22 [Kbytes/sec] received

This generally maps to my experiences thus far with starman and uWSGI -- while the latter has more features, and performs better under nominal conditions, it handles extreme load quite poorly. Unit was clearly superior by a roughly 60% margin or better regardless of the level of load, and could be pushed a great deal farther before falling down than starman or uWSGI. Much of this was due to much more efficient memory usage. So, let's try things out on some (relatively) big iron.

High Spec
# You will be pleased to know I'm writing this off on my taxes
Env: 64GB ram, 48vcpu

# This time we went straight with 100 workers each, and 1k concurrent connections each making 10 requests each.
# We switched to using wrk, because ab fails when you push it very hard.

Unit:
 wrk -t10 -c1000 -d 2m http://localhost:5001/
Running 2m test @ http://localhost:5001/
  10 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   239.60ms  188.61ms   2.00s    90.16%
    Req/Sec   335.32    180.29     1.26k    62.37%
  203464 requests in 2.00m, 799.57MB read
  Socket errors: connect 0, read 9680, write 14750, timeout 608
Requests/sec:   1694.14
Transfer/sec:      6.66MB

uWSGI:
wrk -t10 -c1000 -d 2m http://localhost:5000/
Running 2m test @ http://localhost:5000/
  10 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    60.56ms  112.75ms   1.99s    93.42%
    Req/Sec   268.76    188.69     2.66k    61.73%
  309011 requests in 2.00m, 1.17GB read
  Socket errors: connect 0, read 309491, write 0, timeout 597
Requests/sec:   2573.82
Transfer/sec:      9.97MB

Starman:
 wrk -t10 -c1000 -d 2m http://localhost:5000/
Running 2m test @ http://localhost:5000/
  10 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    24.90ms   47.06ms   1.99s    90.56%
    Req/Sec     4.04k   415.85     4.67k    92.86%
  480564 requests in 2.00m, 1.84GB read
  Socket errors: connect 0, read 0, write 0, timeout 58
Requests/sec:   4002.30
Transfer/sec:     15.73MB

These were surprising results. While unit outperformed uwsgi handily, both were obviously falling down with quite a few failed requests. Meanwhile starman handled them without breaking a sweat, and absolutely trounced both competitors. Japanese perl still winning, clearly. Let's have a look at the automatic-scaling features of uWSGI and unit.

Auto-Scaling!
# Same as above, but with cheaper=1
uwsgi:
wrk -t10 -c1000 -d 2m http://localhost:5000/
Running 2m test @ http://localhost:5000/
  10 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    72.26ms   98.85ms   1.99s    95.18%
    Req/Sec   212.68    157.93   810.00     60.82%
  196466 requests in 2.00m, 760.87MB read
  Socket errors: connect 0, read 196805, write 0, timeout 305
Requests/sec:   1635.89
Transfer/sec:      6.34MB

# Same as above, but processes are now set to 5min and 100 max.
unit:
wrk -t10 -c1000 -d 2m http://localhost:5001/
Running 2m test @ http://localhost:5001/
  10 threads and 1000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   329.91ms   67.84ms   1.14s    81.80%
    Req/Sec   277.56    142.12   720.00     69.52%
  10000 requests in 2.00m, 39.28MB read
  Socket errors: connect 0, read 6795, write 0, timeout 0
Requests/sec:     83.26
Transfer/sec:    334.92KB

This is just so hilariously bad that I can't help but think I'm holding it wrong for unit, but I can't see anything to mitigate this in the documentation. If you need auto-scaling workloads, obviously uWSGI is still the place to be. Even upping the ratio of 'stored' jobs to max to 80% isn't enough to beat uwsgi.

Feature Comparisons

Here are the major features I use in uWSGI, and their counterpart in unit:

Both are configurable via APIs, which makes deploying new sites via orchestration frameworks like kubernetes and so forth straightforward.

Conclusion

Given uWSGI is in "Maintenance only" mode (and has been for some time), I would assume it's well on its way to being put out to pasture. NGINX is quite well funded and well liked, for good cause. Unit gets me the vast majority of what I wanted out of uWSGI, and performs a heck of a lot better, save for when scaling is a concern. Not sure how sold I am on the name, given that's also what systemd calls each service, but I'll take what I can get. I also suspect that given the support this has, the performance problems versus something like starman will be resolved in time. For performance constrained environments where scaling is unlikely, unit gets my enthusiastic endorsement.

Postscript: The details

All testing was done on Ubuntu jammy using the official unit, starman and uwsgi packages. Both hosts were KVM virtual machines. The testing was simply loading a minimally configured tCMS homepage, which is a pure perl PSGI app using Text::XSlate. It's the software hosting this website.

uWSGI configs used (with modifications detailed above) are here.
Starman configuration beyond defaults and specifying job count was not done.
Unit configs used (with modifications detailed above) are here.


Downloads πŸ”— 1631460664  


Downloads

Never say Never πŸ”— 1628695077  

🏷️ video 🏷️ troglovlog
Last time, bro thought he was done talking about organized irresponsibility. Instead, we had a "scrum" at lunch and iterated quickly upon yet more to talk about regarding this.

Organized Irresponsibility: why corporate does what it does πŸ”— 1628521896  

🏷️ video 🏷️ troglovlog
Discussion of the "organized irresponsibility" in corporations, and how it kills the ability to take risks. How this destroys the ability to find meaning in corporate work.

Review BRO TIPS from the Troglodyne Bros! πŸ”— 1621381478  

🏷️ video 🏷️ troglovlog
As always, dealing with the human equation is the more challenging technical problem. Sorry for the lack of video on Monday πŸ˜…

Process vs Mission πŸ”— 1614740942  

🏷️ video
Been a while since we did a duo cast together. Time to remedy that by popping off about current events and how it relates to you as a developer!

Link Unfurling with HTML::SocialMeta πŸ”— 1609954054  

🏷️ video 🏷️ tcms 🏷️ programming 🏷️ blog
I did a deep dive into how pasted links turn into previews in chat and social media applications and was pleasantly surprised to find CPAN had the solution for me. I found a couple of gotchas you might want to know about if you don't want to figure this out the hard way.

Troglodyne Live! Hot Take Testing πŸ”— 1609527292  

🏷️ video 🏷️ troglovlog
Wherein we give the YT streaming a shot, talking about "old news" but that still has the potential for huge implications.

tCMS Retrospective: Houston.pm.org πŸ”— 1609273339  

🏷️ video 🏷️ tcms 🏷️ blog
It took a bit of creative thinking to cram a site that wasn't my brainchild into muh box. Though thankfully it didn't require too much custom fitting and fixes to get the job done.

That said, it could have gone a lot smoother. Discussing that and more!

tCMS Retrospective: Phase 1 Completion πŸ”— 1608164452  

🏷️ video 🏷️ tcms 🏷️ blog
tCMS is more or less doing what we wanted it to. What's more, it fit into the time we allocated for getting it done! Today we looked back at what we did and where we want to go next with Troglodyne.

tCMS Hacking II: Making schema updates πŸ”— 1608089881  

🏷️ video 🏷️ streams 🏷️ programming
Cleaning up after your SQL mistakes is important. Here's how to do it in a way that minimizes downtime.

tCMS Hacking: Removing unneeded schema πŸ”— 1608089748  

🏷️ video 🏷️ streams 🏷️ programming
From the "I should know better" files. Having predictable user identifiers which are also superfluous is pretty bad, and something I already knew not to do, but hey, worse is better!

TrogloVlog: Episode 25 - Cute Animal Bins to stuff your programmers in! πŸ”— 1607807220  

🏷️ video 🏷️ troglovlog
Whee! This management stuff is easy! ...well, maybe not lol Probably not the best idea to compare your employees to zoo animals

TrogloVlog: Episode 24 - Atlassian kills self hosted! Woe unto these companies with that product? πŸ”— 1607803196  

🏷️ video 🏷️ troglovlog
Nah, turns out they probably would have saved money and incurred less risk by just outsourcing that concern in the first place. Atlassian is spot on with the marketing here (and we're not even shilling!)

Press release discussed:
https://www.atlassian.com/migration/journey-to-cloud

tCMS update: ACLs, Sitemaps, RSS and more πŸ”— 1607802643  

🏷️ video 🏷️ tcms
Wherein we get closer to finishing the prototype

TrogloVlog: Episode 23: Don't put Vault Doors on Crackhouses! πŸ”— 1607798051  

🏷️ video 🏷️ troglovlog
Premature Optimization? Put down the pipe!

Troglovlog: Episode 22 - Codes of Comfort πŸ”— 1607797572  

🏷️ video 🏷️ troglovlog
Part 2 of the last cast. Now that we've got inauthenticity and coercion out of the way, let's strike to the heart of the matter: Comfort is overrated!

Troglovlog: Episode 21 - Codes of Coercion πŸ”— 1607796599  

🏷️ video 🏷️ troglovlog
Sometimes management at a firm will codify certain attitudes or practices that employees must hold or follow. Unfortunately, this guarantees inauthenticity. Don't make this mistake unless you want employees to gain cognitive dissonance about your corporate brand.

TrogloVlog: Episode 20 - MicroISV Hero discovers Economic Coordination and the Structure of Production! πŸ”— 1607795580  

🏷️ video 🏷️ troglovlog

TrogloVlog: Episode 19 - Do Patents in the Software World make sense? πŸ”— 1607794454  

🏷️ video 🏷️ troglovlog
Like all headlines with a question mark at the end, the answer is (unsurprisingly) NO. Most of the time patents are an excuse to not actually do the work required to get what you need done, instead validating your identity as "an innovator".

TrogloVlog: Episode 18 - Why Checklists Work in QA and Development πŸ”— 1607793591  

🏷️ video 🏷️ troglovlog
Checklists are used often in many industries, but even to this day we still see a disturbing lack of checklisting in software. Don't make this mistake!

TrogloVlog: Episode 17 - The magic is Showing Up πŸ”— 1607757999  

🏷️ video 🏷️ troglovlog
But how does one show up to work?? Search, of course. In this video we talk in general about how this all works.

Let's see if we can learn how to make magic internet money together!

TrogloVlog: Episode 16 - Why telling Stories is Important πŸ”— 1607757406  

🏷️ video 🏷️ troglovlog
Not just for your business, but for ours as well!

Article mentioned:
https://ariyh.substack.com/p/attach-a-ritual-to-your-product

tCMS Early Progress Report 2 πŸ”— 1607756053  

🏷️ video 🏷️ tcms
Theming, Logins, Dynamic Routes and more!

TrogloVlog: Episode 13 - Judging Risks and Rewards as a fellow traveler in Software πŸ”— 1607752097  

🏷️ video 🏷️ troglovlog
This time we come in with an episode that tries to "bring it all back together" regarding things we've been talking about these past few weeks. We cannot stress enough the importance of judging risks and properly estimating expected rewards as it regards success both in software projects and your own life!

25 most recent posts older than 1607752097
Size:
Jump to:
POTZREBIE
© 2020-2023 Troglodyne LLC